<!--# layout("/common/layout.html",{"jsBase":"/js/activity/activityActionPoint/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="actName" id="actName">
    <input type="hidden" name="actCode" id="actCode">
    <input type="hidden" name="actId" id="actId" value="${actId}">
    <br>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">动作类型</label>
                <div class="layui-input-inline">
                    <select class="select" name="code" id="code"  promtion="请选择" lay-verify="required" lay-filter="code">
                        <option value="">请选择</option>
                        <option value="1" ${activityActionPoint.actCode==1?'selected':''}>发祝福语</option>
                        <option value="2" ${activityActionPoint.actCode==2?'selected':''}>点赞祝福语</option>
                        <option value="3" ${activityActionPoint.actCode==3?'selected':''}>被点赞祝福语</option>
                        <option value="4" ${activityActionPoint.actCode==4?'selected':''}>邀请好友</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
            <label class="layui-form-label">积分类型</label>
				<div class="layui-input-inline">
                    <select class="select" name="pointType" id="pointType"  promtion="请选择" lay-verify="required">
                        <option value="">请选择</option>
                        <option value="1">操作人加分</option>
                        <option value="2">受益人加分</option>
                    </select>
				</div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">积分值</label>
				<div class="layui-input-inline">
                                <input type="text" name="point" id="point" autocomplete="off" maxlength="50" class="layui-input" lay-verify="required|number">
				</div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">总数限制</label>
				<div class="layui-input-inline">
                                <input type="text" name="totalLimit" id="totalLimit" autocomplete="off"
                                       maxlength="50" class="layui-input" lay-verify="required|number">
                    <font color="red">* 0 表示无限制</font>
				</div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">每日限制</label>
				<div class="layui-input-inline">
                    <input type="text" name="dailyLimit" id="dailyLimit" autocomplete="off" maxlength="50" class="layui-input" lay-verify="required|number">
                    <font color="red">* 0 表示无限制</font>
				</div>
            </div>
        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','activityActionPointApi'], function(exports) {
    var form = layui.form;
    var activityActionPointApi = layui.activityActionPointApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(activityActionPointJson))){  -->
    isNew = false;
    $("#code").attr("disabled","disabled");
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    activityActionPointApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    form.on('select(code)', function(data){
         $("#actCode").val($("#code").val()) ;
        $("#actName").val($("#code").find("option:selected").text());
    });
    <!--# if(!(isEmpty(activityActionPointJson))){  -->
    var formJson = ${activityActionPointJson};
    form.val("editform",formJson);
    <!--# } -->
});
</script>
